//// sql语句
// deleteUser字段-删除用户时替换数据
const table_field = `id,name,password,Address,City,test`;
module.exports = {
  /// 查询 'exapp'库中表尾名为‘_table’ 名称表单
  select_table: `select TABLE_NAME from information_schema.TABLES where table_schema='exapp' and TABLE_NAME like binary '%_table' ;`,
  /// 查询users_table表行数
  selectUsersRows:`select count(id) from users_table`,
  /// 创建数据表，并生成各项字段
  // 用户表 昵称 密码 地址 城市 测试
  users_table: `CREATE TABLE users_table (id int(12)  primary key not null auto_increment,name varchar(255),password char(32), Address varchar(255),City varchar(255),test varchar(255));`,
  // 用户注销 删除表
  usersdelete_table: `CREATE TABLE usersdelete_table (id int(12)  primary key not null auto_increment,name varchar(255),password char(32), Address varchar(255),City varchar(255),test varchar(255));`,
  // 文章表
  article_table: `CREATE TABLE article_table (id int(12)  primary key not null auto_increment,name varchar(255),password char(32), Address varchar(255),City varchar(255),Introduction varchar(255));`,
  // 发送的验证码数量
  code_table: `CREATE TABLE code_table (id int(12)  primary key not null auto_increment,i varchar(255));`,
  /// 接口
  // getCate
  getCateSelectSQL: `select * from users_table`,
  // getPostCate
  getPostCateSelectIdSQL: `select * from users_table where id=?`,
  // getCode
  getCodeInsertSQL: `insert into code_table (i) values ('')`,
  // proveCode
  proveCodeSelectNPSQL: `select * from users_table where name=? and password=?`,
  proveCodeSelectNameSQL: `select * from users_table where name=?`,
  // registered
  registeredSelectNameSQL: `select * from users_table where name=?`,
  registeredInsertUserSQL: `insert into users_table (name, password,test) values (?, ?, ?)`,
  // editUser
  editUserSelectNameSQL: `select * from users_table where name=?`,
  editUserUpdateSQL: `UPDATE users_table SET name = ?, password = ?, test = ? where name=?`,
  // getInfo
  getInfoSelectNPSQL: `select * from users_table where name=? and password=?`,
  getInfoSelectIdSQL: `select id from code_table`,
  // deleteUser
  deleteUserInsertSQL: `INSERT INTO usersdelete_table ( ${table_field} ) SELECT ${table_field} FROM users_table WHERE name = ?`,
  deleteUserDeleteSQL: `delete from users_table where name=?`,
  // paging
  pagingSQL:`SELECT * FROM users_table limit ?,?;`
};
